<script>
	import wxShare from "./utils/wxShare.js";
	import Vue from 'vue'
	export default {
		mixins: [wxShare],
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == "android") {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					}
					// #endif

					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar =
						custom.bottom + custom.top - e.statusBarHeight;
					// #endif

					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				},
			});
		},
		onShow: function(options) {
			let token = uni.getStorageSync("access_token") || ''
			if (!token) {
				uni.reLaunch({
					url: '/pages/home/login'
				})
			}
			
			const { referrerInfo, scene } = options;
			    /* 判断是否从腾讯云E证通返回 */
			const { appId } = referrerInfo;
			  if(scene === 1038 && appId === 'wxa0a9f6f0154bbe7d') {
			    const { extraData } = referrerInfo;
			    if(extraData) {
			      const { token, verifyDone } = extraData;
			      console.log(token, verifyDone);
			      if(verifyDone) {
			        uni.setStorageSync('isFace','1')
			      }
			    };
			  return
			}
		},
		onHide: function() {
			// console.log("App Hide");
		},
	};
</script>

<style lang="scss">
	@import 'uview-ui/index.scss';

	body {
		background: #F6F8FF;
	}
</style>
